{extend name="property/public/insidePageBase" /}
{block name="title"}车场编辑{/block}
{block name="body"}
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-form layui-form-pane">
            <div class="layui-row">
                <div class="layui-col-xs6">
                    <div class="layui-form-item">
                        <label class="layui-form-label">物业筛选</label>
                        <div class="layui-input-block">
                            <select name="property_id" lay-filter="property_id" lay-search>
                                <option value="">--请选择--</option>
                                {foreach $propertyData as $v}
                                <option value="{$v['id']}" {if ($info['property_id'] == $v['id'])}selected{/if}>{$v['name']}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs6">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">车场名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="iot_name" value="{$info['iot_name']??''}" placeholder="请输入(5-25个字)" class="layui-input" lay-verify="required" autocomplete="off"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs6">
                    <div class="layui-form-item" pane="">
                        <label class="layui-form-label">车场编号</label>
                        <div class="layui-input-block">
                            <input type="text" name="iot_key" value="{$info['iot_key']??''}" placeholder="请输入" class="layui-input" lay-verify="required" autocomplete="off"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs6">
                    <div class="layui-form-item" pane="">
                        <label class="layui-form-label">MAC地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="device_mac"  value="{$info['device_mac']??''}" placeholder="请输入" class="layui-input" lay-verify="required" autocomplete="off"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs6">
                    <div class="layui-form-item" pane="">
                        <label class="layui-form-label">通信类型</label>
                        <div class="layui-input-block">
                            <input type="radio" name="mesh_type" value="1" title="微电脑" {:isset($info['mesh_type']) ? $info['mesh_type'] == 1 ? 'checked' : '' : ''}/>
                            <input type="radio" name="mesh_type" value="2" title="相机云" {:isset($info['mesh_type']) ? $info['mesh_type'] == 2 ? 'checked' : '' : ''}/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs6">
                    <div class="layui-form-item" pane="">
                        <label class="layui-form-label">车位数量</label>
                        <div class="layui-input-block">
                            <input type="text" name="stall_num"  value="{$info['stall_num']??''}" placeholder="请输入" class="layui-input" lay-verify="required" autocomplete="off"/>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-row">
                <div class="layui-col-xs6">
                    <div class="layui-form-item" pane="">
                        <label class="layui-form-label">计费模式</label>
                        <div class="layui-input-block">
                            <input type="radio" name="plan_type" value="1" title="方案收" {:isset($info['plan_type']) ? $info['plan_type'] == 1 ? 'checked' : '' : ''}/>
                            <input type="radio" name="plan_type" value="2" title="全免费" {:isset($info['plan_type']) ? $info['plan_type'] == 2 ? 'checked' : '' : ''}/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs6">
                    <div class="layui-form-item" pane="">
                        <label class="layui-form-label">启用状态</label>
                        <div class="layui-input-block">
                            <input type="radio" name="is_show" value="1" title="启用" {:isset($info['is_show']) ? $info['is_show'] == 1 ? 'checked' : '' : ''}/>
                            <input type="radio" name="is_show" value="2" title="关闭" {:isset($info['is_show']) ? $info['is_show'] == 2 ? 'checked' : '' : ''}/>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-row">
                <div class="layui-col-xs10">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">详细地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="address" value="{$info['address']??''}" id="address" placeholder="请输入所属地址" class="layui-input" autocomplete="off"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs2">
                    <button class="layui-btn layui-btn-primary layui-border" type="button" id="map_location"><i class="layui-icon layui-icon-location"></i>定位选择</button>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注说明</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入"  name="remark" class="layui-textarea">{$info['remark']??''}</textarea>
                </div>
            </div>

            <div class="layui-form-item layui-hide">
                <input type="hidden" name="longitude" id="longitude" value="{$info['longitude'] ?? ''}" />
                <input type="hidden" name="latitude" id="latitude" value="{$info['latitude'] ?? ''}" />
                <button type="button" class="layui-btn layui-btn-primary replaceUploadImg toggleUpload" lay-data="{}"></button>
                <button class="layui-btn" lay-submit lay-filter="submitBtn" id="submitBtn">提交</button>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
{__block__}
<script>
    layui.use(['form', 'layer'], function () {
        var form = layui.form,layer = layui.layer,  $ = layui.$;
        $('#map_location').on('click', function() {
            parent.layer.open({
                type: 2,
                title: '定位',
                content: "/static/maplocation/index.html",
                area: ['500px', '500px'],
                btn: ['确认','取消'],
                yes: function(index, layero){
                    choseeArea = parent.window.frames['layui-layer-iframe'+index].choseeArea;
                    if(choseeArea === undefined) {
                        return parent.layer.msg('请选择地区');
                    }
                    $('#address').val(choseeArea.regeocode.formattedAddress);
                    $('#latitude').val(choseeArea.lnglat.lat);
                    $('#longitude').val(choseeArea.lnglat.lng);
                    parent.layer.close(index);
                }
            });
        });
    });
</script>
{/block}